/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package reader;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.LinkedList;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Administrator
 */
public class NavigationAndQuestionReader {

    public LinkedList<Property> propertyList = new LinkedList<Property>();
    public LinkedList<Question> questionList = new LinkedList<Question>();
    private BufferedReader br;
    private String line;

    void readNavigation() {
        try {
            br = new BufferedReader(new FileReader("File.txt"));
            while ((line = br.readLine()) != null) {
                Property pr = new Property();
                pr.setNumberOfQuestion(line.charAt(0));
                pr.setAnsverNumber(line.charAt(1));
                pr.setNextQuestion(line.charAt(2));
                pr.setQuestionType(line.substring(3, 6));
                propertyList.add(pr);
                line = "";
            }
            System.out.println(propertyList.get(2));
        } catch (FileNotFoundException ex) {
            Logger.getLogger(NavigationAndQuestionReader.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(NavigationAndQuestionReader.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void readQuestions() {
        try {
            br = new BufferedReader(new FileReader("Questions.txt"));
            String line2;
            while ((line2 = br.readLine()) != null) {
                int i = 0;
                Question q = new Question();
                q.setNumber(i);
                q.setTextOfQuestion(line2);
                questionList.add(q);
                i++;

            }


        } catch (FileNotFoundException ex) {
            Logger.getLogger(NavigationAndQuestionReader.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(NavigationAndQuestionReader.class.getName()).log(Level.SEVERE, null, ex);

        }
    }



    public static void main(String[] args) {
        NavigationAndQuestionReader n = new NavigationAndQuestionReader();
        n.readNavigation();
        n.readQuestions();

    }
}
